#ifndef __JSONCONFIG_H__
#define __JSONCONFIG_H__
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
typedef std::map<uint8_t,std::map<uint8_t,std::vector<uint16_t>>> PointList;
typedef struct ConfigFileType
{
    std::string modbusfile;     /*< Modbus从站地址设置文件*/
    struct
    {
        std::string rtuport;
        int baudrate;
        char parity;            /*< N无 O奇 E偶 M-1 S-0 */
        int databit;
        int stopbit;
    }rtuconfig;
    struct
    {
        int port;
    }tcpconfig;
    struct
    {
        int looptimeout;        /*< 循环时间间隔 20ms*/
        int requesttimeout;     /*< ModbusRTU等待超时 500ms*/
        int commtimeout;        /*< ModbusRTU两次发送最小间隔 20ms*/
        int pollingtimeout;     /*< 轮询间隔 500ms*/
        int maxnb;              /*< 最大连续读取寄存器数 32*/
    }bridgeconfig;
    PointList points;
    bool debuglog;
    int loglevel;
}BridgeConfig;


bool ModbusJsonConfig();
void defaultconfig();
bool BridgeJsonConfig(std::string file);

extern BridgeConfig config;
#endif